using Neo.Generator.Core;
using Neo.MetaModel;


namespace Neo.Generator.CodeGen
{

    ///<summary>The Code Generation Context
	///</summary>
	public class CodeGenerationContext : GenerationContext
	{
		//--------------------------------------------------------------------------------------
		//	fields / constructor
		//--------------------------------------------------------------------------------------

		private Entity	entity;
		private ModelHelper helper;
		private CodeGenerator _codeGen;

        /// <summary>
        /// Initializes a new instance of the <see cref="CodeGenerationContext"/> class.
        /// </summary>
        /// <param name="anEntity">An entity.</param>
        /// <param name="codeGen">The code gen.</param>
		public CodeGenerationContext(Entity anEntity, CodeGenerator codeGen)
		{
			entity = anEntity;
			_codeGen = codeGen;
			helper = new ModelHelper(entity);
		}

		
		//--------------------------------------------------------------------------------------
		//	properties
		//--------------------------------------------------------------------------------------

        /// <summary>
        /// Gets the helper.
        /// </summary>
        /// <value>The helper.</value>
		public virtual ModelHelper Helper
		{
			get { return helper; }
		}


        /// <summary>
        /// Gets the model.
        /// </summary>
        /// <value>The model.</value>
		public override Model Model
		{
			get { return entity.Model; }
		}


        /// <summary>
        /// Gets the entity.
        /// </summary>
        /// <value>The entity.</value>
		public virtual Entity Entity
		{
			get { return entity; }
		}


        /// <summary>
        /// Gets the name of the file.
        /// </summary>
        /// <value>The name of the file.</value>
		public virtual string FileName
		{
            get { return Entity.ClassName + _codeGen.UserFileExtension; }
		}


        /// <summary>
        /// Gets the name of the support file.
        /// </summary>
        /// <value>The name of the support file.</value>
		public virtual string SupportFileName
		{
            get { return "_" + Entity.ClassName + _codeGen.SupportFileExtension; }
		}
	

	}
}
